# -*- coding:utf-8 -*-

import copy
import random
import string

mydict = {
  "name": "Tom",
  "age": "18",
  "sex": 1,
  "city": "深圳",
  "province": "广东",
  "ext": {
    "type": "dynamic",
    "inner_hits": {},
    "score_mode": "avg",
    "min_children": 0,
    "max_children": 25555,
    "ignore_unmapped": False,
    "boost": 1
  }
}
users = []
names = []
i = 0
while i <= 9:
    newdict = copy.deepcopy(mydict)
    name = ''.join(random.sample(string.ascii_lowercase, random.randint(3, 5)))
    names.append(name)
    if name in names:
        name = ''.join(random.sample(string.ascii_lowercase, random.randint(3, 5)))
    newdict['name'] = name
    newdict['age'] = random.randint(11, 59)
    newdict['sex'] = random.randint(0, 2)
    newdict['ext']['boost'] = random.randint(0, 3)
    i += 1
    users.append(newdict)
    print(newdict)
print(users)



